#@layout()

#define css()
<style>

    .attachment_item {
        height: 220px;
        width: 200px;
        padding: 0px;
        border: 1px solid #ddd;
        margin: 10px;
        float: left;
        cursor: pointer;
    }

    .attachment_item:hover {
        border: 1px solid #3c8dbc;
    }

    .attachment_item img {
        height: 90%;
        min-height: 90%;
        width: 100%;
    }

    .attachment_item_title {
        height: 10%;
        background-color: #ecf0f5;
        text-align: center;
        padding: 0 5px;
        overflow: hidden;
    }

    .attachment_item_title p {
        overflow: hidden;
    }

</style>
#end

#define script()
<script>
    function show(id) {
        layer.open({
            type: 2,
            title: '附件详情',
            anim: 2,
            shadeClose: true,
            shade: 0.3,
            area: ['80%', '60%'],
            content: '#(CPATH)/admin/attachment/detail/' + id,
            end: function () {
                if (layer.data.needReload == true) {
                    location.reload();
                }
            }
        });
    }
</script>
#end

#define content()

    <section class="content-header">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-6">

                    <div class="row mb-2">
                        <div class="col-sm-12">
                            <h1>
                                附件管理
                                <small data-toggle="tooltip" title="" data-placement="right"
                                       data-trigger="hover"><i class="nav-icon far fa-question-circle"></i></small>
                                <small> 首页 / 附件 / 附件管理</small>
                            </h1>
                        </div>
                    </div>

                </div>


                <div class="col-sm-6 ">
                    <div class=" float-sm-right" style="padding-top:15px ">
                        <a href="#(CPATH)/admin/attachment/upload" class="btn btn-primary ">
                            <i class="fas fa-plus"></i> 上传
                        </a>
                    </div>
                </div>

            </div>

        </div><!-- /.container-fluid -->
    </section>

    <section class="content">

        <div class="container-fluid">
                <div class="card card-outline card-primary">
                    <div class="card-header with-border">
                        <form class="admin-search-panel" action="" method="get">
                            <div class="row">
                                <div class="form-group col-lg-2">
                                        <input type="text" placeholder="标题" class="form-control" name="title" value="#para('title')">
                                </div>
                                <div class="form-group col-lg-2">
                                        <button type="submit" class="btn btn-primary ">查询</button>
                                        <button type="reset" class="btn btn-default">重置</button>

                                </div>
                            </div>
                            <!-- /.card-body -->
                        </form>


                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">

                        <div class="col-12 ">
                            <div class="row">
                                #for(attachment : page.list ??)
                                <div class="attachment_item">
                                    #if(attachment.isImage())
                                    <img src="#(CPATH)#(attachment.path ??)" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isDoc())
                                    <img src="#(CPATH)/static/commons/img/suffix/doc.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isXls())
                                    <img src="#(CPATH)/static/commons/img/suffix/xls.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isPpt())
                                    <img src="#(CPATH)/static/commons/img/suffix/ppt.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isTxt())
                                    <img src="#(CPATH)/static/commons/img/suffix/txt.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isZip())
                                    <img src="#(CPATH)/static/commons/img/suffix/zip.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isRar())
                                    <img src="#(CPATH)/static/commons/img/suffix/rar.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isExe())
                                    <img src="#(CPATH)/static/commons/img/suffix/exe.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isPdf())
                                    <img src="#(CPATH)/static/commons/img/suffix/pdf.png" title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isAudio())
                                    <img src="#(CPATH)/static/commons/img/suffix/audio.png"
                                         title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #elseif(attachment.isVideo())
                                    <img src="#(CPATH)/static/commons/img/suffix/video.png"
                                         title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #else
                                    <img src="#(CPATH)/static/commons/img/suffix/unknow.png"
                                         title="#(attachment.title ??)"
                                         alt="#(attachment.title ??)" onclick='show("#(attachment.id ??)")'>
                                    #end
                                    <div class="attachment_item_title">
                                        <p>#(attachment.title ??)</p>
                                    </div>
                                </div>
                                #end
                            </div>
                        </div>


                    </div>
                    <!-- /.card-body -->
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="row">

                                    <div class="form-group">
                                        <div class="form-check">
                                            <input class="form-check-input tableCheckAll" id="checkall" type="checkbox" >
                                            <label class="form-check-label" for="checkall">全选</label>
                                        </div>
                                    </div>
                                    <div class="form-group col-lg-3">
                                        <select class="form-control" name="action">
                                            <option value="">请选择...</option>
                                            <option value="doDelByIds" open-type="del-confirm">
                                                批量删除
                                            </option>
                                        </select>
                                    </div>

                                    <div class="form-group col-lg-3">
                                        <button type="button" class="btn btn-outline-primary batchExec">批量操作</button>
                                    </div>
                                </div>
                            </div>

                            <div class="col-sm-6">
                                #@_paginate()
                            </div>
                        </div>
                    </div>
                    <!-- /.card-footer -->
                </div>
                <!-- /.card -->
            </div>
    </section>


#end
